package file;

import java.io.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: YKH
 * Date: 2022-08-07
 * Time: 15:39
 */
//使用PrintWriter写
public class Demo12 {
    public static void main(String[] args) throws FileNotFoundException {
        try(OutputStream outputStream = new FileOutputStream("test.txt")) {
            PrintWriter printWriter = new PrintWriter(outputStream);
            printWriter.print("12346"); //PrinWriter 会将内容先写到缓冲区
            printWriter.flush(); //清除缓冲区
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
